package com.aspose.cells;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;

class zok {
   Workbook a;
   zack b;
   ArrayList c;
   zof d;
   HashMap e;
   HashMap f = new HashMap();
   HashMap g;
   ArrayList h;
   HashMap i;
   int j = 1;
   int k = 0;
   boolean l = true;
   private int E = 1;
   private ArrayList F = new ArrayList();
   com.aspose.cells.a.f.zi m = null;
   ArrayList n = new ArrayList();
   ArrayList o = new ArrayList();
   String p = ".xml";
   boolean q = true;
   private int G = 1;
   private int H = 1;
   private int I = 1;
   private int J = 1;
   private int K = 1;
   int r = 1;
   private int L = 1;
   int s = 0;
   private int M;
   HashMap t = new HashMap();
   zalh u;
   int v = 1;
   boolean w = false;
   int x = 1;
   zaay y;
   HashMap z;
   ArrayList A;
   String B = null;
   String C = null;
   zod D;
   private int N = 1;
   private static final com.aspose.cells.b.c.a.za O = new com.aspose.cells.b.c.a.za(new String[]{"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", "xls", "xltx", "xltm", "xlsx", "xlsm", "doc", "dot", "docm", "docx", "dotm", "dotx", "ppt", "pptm", "pptx", "sldx", "application/vnd.openxmlformats-package.core-properties+xml", "application/vnd.openxmlformats-officedocument.spreadsheetml.revisionLog+xml", "application/vnd.openxmlformats-officedocument.spreadsheetml.userNames+xml", "application/vnd.openxmlformats-officedocument.spreadsheetml.revisionHeaders+xml"});

   zok(Workbook var1, com.aspose.cells.a.f.zi var2, boolean var3, boolean var4) throws Exception {
      this.a = var1;
      this.m = var2;
      this.l = var3;
      this.p = var4 ? ".xml" : ".bin";
      this.q = var4;
      this.n();
   }

   zok(Workbook var1, com.aspose.cells.a.f.zi var2, boolean var3, int var4) throws Exception {
      this.a = var1;
      this.m = var2;
      this.l = var3;
      this.M = var4;
      this.n();
   }

   private void i() {
      byte var1 = 1;
      zbmv var2 = this.a.getWorksheets().W();
      int var3 = var2.getCount();
      if (var3 != 0) {
         this.z = new HashMap();
         this.A = new ArrayList();

         for(int var4 = 0; var4 < var3; ++var4) {
            zbmu var5 = var2.a(var4);
            int var6 = var1 + var4;
            zqk var7 = new zqk();
            var7.d = var5;
            var7.c = var6;
            String var8 = "slicerCaches/slicerCache" + var7.c + this.p;
            var7.b = "xl/" + var8;
            String var9 = this.c("http://schemas.microsoft.com/office/2007/relationships/slicerCache", var8).c;
            var7.a = var9;
            ArrayList var10 = null;
            if (this.z.get(var5.a) == null) {
               var10 = new ArrayList();
               this.z.put(var5.a, var10);
            } else {
               var10 = (ArrayList)this.z.get(var5.a);
            }

            com.aspose.cells.b.a.a.ze.a(var10, (Object)var9);
            com.aspose.cells.b.a.a.ze.a(this.A, (Object)var7);
            String var11 = "/xl/slicerCaches/slicerCache" + var7.c + this.p;
            this.a(var11, "application/vnd.ms-excel.slicerCache+xml");
         }

      }
   }

   private void j() {
      this.i = new HashMap();
      int var1 = this.k();

      for(int var2 = 0; var2 < this.a.getWorksheets().getCount(); ++var2) {
         Worksheet var3 = this.a.getWorksheets().get(var2);
         PivotTableCollection var4 = var3.b;
         if (var3.getType() == 1 && var4 != null && var4.getCount() > 0) {
            for(int var5 = 0; var5 < var4.getCount(); ++var5) {
               PivotTable var6 = var4.get(var5);
               this.i.put(var6, var1);
               ++var1;
            }
         }
      }

   }

   private int k() {
      int var1 = 1;
      if (this.a != null && this.a.b != null) {
         var1 = this.a.b.i.b + 1;
      }

      return var1;
   }

   int a() {
      return this.G++;
   }

   int b() {
      return this.H++;
   }

   int c() {
      return this.k + this.K++;
   }

   int d() {
      int var1;
      for(var1 = this.E; this.F.contains(var1); var1 = ++this.E) {
         ;
      }

      ++this.E;
      return var1;
   }

   int e() {
      return this.L++;
   }

   int f() {
      return this.I++;
   }

   int g() {
      return this.J++;
   }

   private void l() throws Exception {
      int var1 = 1;
      int var2 = 1;
      int var3 = 1;

      for(int var4 = 0; var4 < this.a.getWorksheets().getCount(); ++var4) {
         Worksheet var5 = this.a.getWorksheets().get(var4);
         zol var6;
         String var7;
         if (var5.getType() == 1) {
            var6 = new zol(this, var5, var1, var2);
            com.aspose.cells.b.a.a.ze.a(this.c, (Object)var6);
            var7 = "worksheets/sheet" + zase.y(var2) + this.p;
            var6.k = this.c("http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet", var7).c;
            ++var1;
            ++var2;
         } else if (var5.getType() == 2 && (zase.a(var5.getCharts().get(0)) || var5.g != null)) {
            var6 = new zol(this, var5, var1, var3);
            com.aspose.cells.b.a.a.ze.a(this.c, (Object)var6);
            var7 = "chartsheets/sheet" + var3 + this.p;
            var6.k = this.c("http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartsheet", var7).c;
            ++var1;
            ++var3;
         }
      }

   }

   private void m() {
      zbqf var1 = this.a.getWorksheets().v();
      int var2 = 0;

      for(int var3 = 0; var3 < var1.getCount(); ++var3) {
         zbqg var4 = var1.a(var3);
         String var5 = var4.k();
         if (var5 != null && var5.trim().length() != 0 && (var4.a() == 3 || var4.a() == 0 || var4.a() == 4)) {
            ++var2;
            String var6 = "/xl/externalLinks/externalLink" + var2 + this.p;
            if (this.q) {
               this.a(var6, "application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml");
            } else {
               this.a(var6, "application/vnd.ms-excel.externalLink");
            }

            zqe var7 = this.c("http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink", "externalLinks/externalLink" + var2 + this.p);
            this.t.put(var3, var7);
         }
      }

   }

   private void n() throws Exception {
      if (this.a.b != null) {
         this.C = this.a.b.n;
      }

      if (this.C == null && this.a.getRibbonXml() != null && this.a.getRibbonXml().length() > 0) {
         this.C = "customUI/customUI.xml";
      }

      this.a.a(this);
      this.b = this.a.getWorksheets().p();
      if (this.b == null) {
         this.b = new zack(this.a);
      }

      CalculationOptions var1 = new CalculationOptions();
      var1.h = false;
      var1.b = true;
      this.y = new zaay(this.a, 3, var1);
      this.d = zof.a(this);
      this.c = new ArrayList();
      this.e = new HashMap();
      this.G();
      this.o();
      if (this.q) {
         this.b("rels", "application/vnd.openxmlformats-package.relationships+xml");
         this.b("xml", "application/xml");
         this.B = this.E();
      } else {
         this.b("rels", "application/vnd.openxmlformats-package.relationships+xml");
         this.b("xml", "application/xml");
         this.b("bin", "application/vnd.ms-excel.sheet.binary.macroEnabled.main");
         this.B = "application/vnd.ms-excel.sheet.binary.macroEnabled.main";
      }

      this.q();
      this.H();
      this.I();
      this.t();
      this.j();
      this.i();
      this.l();
      this.s();
      if (this.l && this.a.hasMacro()) {
         this.c("http://schemas.microsoft.com/office/2006/relationships/vbaProject", "vbaProject.bin");
      }

      this.c("http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles", "styles" + this.p);
      this.c("http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings", "sharedStrings" + this.p);
      this.c("http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme", "theme/theme1.xml");
      this.A();
      this.m();
      if (this.a.h != null && this.a.h.getCount() > 0) {
         this.c("http://schemas.openxmlformats.org/officeDocument/2006/relationships/connections", "connections.xml");
      }

      if (this.a.getWorksheets().getXmlMaps() != null && this.a.getWorksheets().getXmlMaps().getCount() > 0) {
         this.c("http://schemas.openxmlformats.org/officeDocument/2006/relationships/xmlMaps", "xmlMaps.xml");
      }

      if (this.q) {
         this.x();
         this.r();
         this.p();
      } else {
         this.D();
         this.r();
         this.p();
      }

      if (this.a.g() instanceof OoxmlSaveOptions) {
         LightCellsDataProvider var2 = ((OoxmlSaveOptions)this.a.g()).getLightCellsDataProvider();
         if (var2 != null) {
            this.u = new zali(this, var2);
         }
      }

      this.y();
   }

   private void o() throws Exception {
      if ((this.a.b == null || this.a.b.k == null || this.a.b.k.size() == 0) && this.a.c != null && this.a.c.d != null) {
         Iterator var1 = this.a.c.d.values().iterator();

         while(var1.hasNext()) {
            zqe var2 = (zqe)var1.next();
            switch(O.a(var2.d)) {
            case 0:
               this.a(var2.e);
               int var3 = this.d();
               String var4 = "../media/image" + var3 + com.aspose.cells.a.c.zt.c(var2.e);
               var2.e = var4;
            }
         }
      }

   }

   private void p() throws Exception {
      for(int var1 = 0; var1 < this.c.size(); ++var1) {
         zol var2 = (zol)this.c.get(var1);
         var2.b();
      }

   }

   private boolean a(zpk var1) throws Exception {
      com.aspose.cells.a.f.zh var2 = this.m.a(var1.b);
      com.aspose.cells.b.a.d.zm var3 = this.m.a(var2);
      zcfk var4 = zass.a((com.aspose.cells.b.a.d.zm)var3, (zcft)null, true);
      var3.a();
      return "userShapes".equals(var4.d_().g);
   }

   private void q() {
      if (this.a.b != null && this.a.b.k.size() != 0) {
         ArrayList var1 = this.a.b.k;

         for(int var2 = 0; var2 < var1.size(); ++var2) {
            zpk var3 = (zpk)var1.get(var2);
            if (var3.a.equals("media")) {
               String var4 = var3.b;
               int var5 = var4.lastIndexOf(47);
               int var6 = var4.lastIndexOf(46);
               String var7;
               if (var5 < var6) {
                  var7 = var4.substring(var5 + 6, var5 + 6 + (var6 - var5 - 6));
               } else {
                  var7 = var4.substring(var5 + 6);
               }

               try {
                  com.aspose.cells.b.a.a.ze.a(this.F, (Object)com.aspose.cells.b.a.zo.a(var7));
               } catch (Exception var9) {
                  ;
               }
            }
         }

      }
   }

   private void r() throws Exception {
      if (this.a.b != null && this.a.b.k.size() != 0) {
         ArrayList var1 = this.a.b.k;

         for(int var2 = 0; var2 < var1.size(); ++var2) {
            zpk var3 = (zpk)var1.get(var2);
            if (var3.a.equals("drawings")) {
               int var4 = this.b();
               var3.c = "xl/drawings/drawing" + var4 + ".xml";
               if (this.a(var3)) {
                  this.a("/" + var3.c, "application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml");
               } else {
                  this.a("/" + var3.c, "application/vnd.openxmlformats-officedocument.drawing+xml");
               }
            } else if (var3.a.equals("charts")) {
               String var7 = com.aspose.cells.a.c.zt.b(var3.b);
               String var5 = "application/vnd.openxmlformats-officedocument.drawingml.chart+xml";
               if (var7.startsWith("style")) {
                  var3.c = var3.b;
                  var5 = "application/vnd.ms-office.chartstyle+xml";
               } else if (var7.startsWith("colors")) {
                  var3.c = var3.b;
                  var5 = "application/vnd.ms-office.chartcolorstyle+xml";
               } else {
                  int var6 = this.c();
                  var3.c = "xl/charts/chart" + var6 + ".xml";
               }

               this.a("/" + var3.c, "application/vnd.openxmlformats-officedocument.drawingml.chart+xml");
            } else if (var3.a.equals("pivotCache")) {
               var3.c = var3.b;
               this.a("/" + var3.c, "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml");
            } else if (var3.a.equals("pivotTables")) {
               var3.c = var3.b;
               this.a("/" + var3.c, "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml");
            } else if (var3.a.equals("media")) {
               var3.c = var3.b;
            } else {
               var3.c = var3.b;
            }
         }

      }
   }

   private void s() {
      if (this.h != null && this.h.size() != 0) {
         Iterator var1 = this.h.iterator();

         while(var1.hasNext()) {
            zqc var2 = (zqc)var1.next();
            zauk var3 = var2.a;
            if (var3.E == null) {
               String var4 = null;
               if (var3.F != null) {
                  int var5 = var3.F.indexOf(".");
                  if (var5 != -1) {
                     String var6 = var3.F.substring(0, 0 + var5) + this.p;
                     var4 = "pivotCache/" + var6;
                  }
               } else {
                  var4 = "pivotCache/pivotCacheDefinition" + var2.g + this.p;
               }

               String var7 = this.c("http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition", var4).c;
               var2.e = var7;
            } else {
               var2.e = this.c("http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition", var2.d).c;
            }
         }

      }
   }

   private void t() {
      int var1 = this.v();
      int var2 = this.u();
      zaul var3 = this.a.getWorksheets().U();
      int var4 = var3.getCount();
      if (var4 != 0) {
         int var5;
         String var8;
         int var9;
         for(var5 = 0; var5 < var4; ++var5) {
            String var6 = var3.a(var5).F;
            if (var6 != null) {
               int var7 = var6.lastIndexOf(46);
               var8 = var6.substring(0, 0 + var7);
               var9 = zase.ab(var8);
               if (var1 < var9) {
                  var1 = var9;
               }
            }
         }

         this.h = new ArrayList(var4);
         var5 = 0;

         for(int var16 = 0; var16 < var4; ++var16) {
            zauk var17 = var3.a(var16);
            var8 = null;
            int var10;
            String var11;
            int var12;
            zqc var18;
            if (var17.E != null) {
               zqc var19 = var17.E;
               var18 = var19;
               var10 = var19.d.lastIndexOf(46);
               var11 = var19.d.substring(0, 0 + var10);
               var19.g = zase.ab(var11);
            } else {
               var9 = var1 + var5++;
               var18 = new zqc(var17);
               var18.f = var17.F;
               var18.g = var9;
               if (var18.f != null) {
                  var10 = var18.f.lastIndexOf(46);
                  var11 = var18.f.substring(0, 0 + var10);
                  var12 = zase.ab(var11);
                  if (var12 != var9) {
                     var9 = var12;
                  }

                  var18.g = var9;
               }

               var18.c = zase.y(var2 + var16);
            }

            if (var18 != null) {
               com.aspose.cells.b.a.a.ze.a(this.h, (Object)var18);
               if (var17.C != null && var17.C.size() > 0) {
                  Iterator var20 = var17.C.keySet().iterator();

                  while(var20.hasNext()) {
                     String var21 = (String)var20.next();
                     zqe var22 = (zqe)var17.C.get(var21);
                     if (var22.e.startsWith("pivotCacheRecords")) {
                        var12 = var22.e.indexOf(".");
                        String var13 = var22.e.substring(0, 0 + var12);
                        int var14 = zase.ab(var13);
                        String var15 = var22.e.substring(var12, var12 + (var22.e.length() - var13.length()));
                        if (var14 != var18.g) {
                           var22.e = "pivotCacheRecords" + var18.g + var15;
                        }
                     }
                  }
               }
            }
         }

      }
   }

   private int u() {
      int var1 = 0;
      if (this.a != null && this.a.b != null) {
         var1 = this.a.b.i.c;
      }

      Iterator var2 = this.a.getWorksheets().U().iterator();

      while(var2.hasNext()) {
         zauk var3 = (zauk)var2.next();
         zqc var4 = var3.E;
         if (var4 != null && var4.c != null) {
            try {
               int var5 = zase.C(var4.c);
               if (var5 >= var1) {
                  var1 = var5 + 1;
               }
            } catch (Exception var6) {
               ;
            }
         }
      }

      return var1;
   }

   private int v() {
      int var1 = 0;
      if (this.a != null && this.a.b != null) {
         var1 = this.a.b.i.c;
      }

      Iterator var2 = this.a.getWorksheets().U().iterator();

      while(var2.hasNext()) {
         zauk var3 = (zauk)var2.next();
         zqc var4 = var3.E;
         if (var4 != null) {
            String var5 = var4.d;
            int var6 = var5.lastIndexOf(46);
            var5 = var5.substring(0, 0 + var6);
            int var7 = zase.ab(var5);
            if (var7 >= var1) {
               var1 = var7 + 1;
            }
         }
      }

      return var1;
   }

   private void b(String var1, String var2) {
      if (!this.b(var1)) {
         znt var3 = new znt();
         var3.a = true;
         var3.b = var1;
         var3.d = var2;
         com.aspose.cells.b.a.a.ze.a(this.o, (Object)var3);
      }
   }

   private boolean b(String var1) {
      for(int var2 = 0; var2 < this.o.size(); ++var2) {
         znt var3 = (znt)this.o.get(var2);
         if (com.aspose.cells.b.a.zv.b(var3.b, var1)) {
            return true;
         }
      }

      return false;
   }

   void a(String var1, String var2) {
      znt var3 = new znt();
      var3.a = false;
      var3.c = var1;
      var3.d = var2;
      com.aspose.cells.b.a.a.ze.a(this.o, (Object)var3);
   }

   private void w() throws Exception {
      if (this.f != null && this.f.size() != 0 || this.g != null && this.g.size() != 0 || this.n.size() != 0) {
         ArrayList var1 = new ArrayList();
         com.aspose.cells.b.a.a.ze.a(var1, (Collection)this.n);
         if (this.f != null) {
            com.aspose.cells.b.a.a.ze.a(var1, this.f.values());
         }

         if (this.g != null) {
            com.aspose.cells.b.a.a.ze.a(var1, this.g.values());
         }

         for(int var2 = 0; var2 < var1.size(); ++var2) {
            String var3 = (String)var1.get(var2);
            this.a(var3);
         }

      }
   }

   void a(String var1) throws Exception {
      String var2 = null;
      String var3 = null;

      try {
         var3 = com.aspose.cells.b.a.d.zk.d(var1);
         if (var3.length() < 2) {
            return;
         }

         var3 = var3.substring(1);
         if ("jpeg".equals(var3)) {
            var2 = "image/" + var3;
         } else if ("png".equals(var3)) {
            var2 = "image/" + var3;
         } else if ("emf".equals(var3)) {
            var2 = "image/x-emf";
         } else if ("wmf".equals(var3)) {
            var2 = "image/x-wmf";
         } else if ("bmp".equals(var3)) {
            var2 = "image/" + var3;
         }
      } catch (Exception var5) {
         if (var1.indexOf(".jpg") != -1) {
            var3 = "jpeg";
            var2 = "image/" + var3;
         }
      }

      if (var2 != null) {
         this.b(var3, var2);
      }

   }

   private void x() throws Exception {
      this.w();
      this.a("/xl/theme/theme1.xml", "application/vnd.openxmlformats-officedocument.theme+xml");
      this.a("/xl/styles.xml", "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml");
      if (this.l) {
         if (this.M == 9) {
            this.a("/xl/workbook.xml", "application/vnd.ms-excel.template.macroEnabled.main+xml");
         } else if (this.M == 10) {
            this.a("/xl/workbook.xml", "application/vnd.ms-excel.addin.macroEnabled.main+xml");
         } else {
            this.a("/xl/workbook.xml", "application/vnd.ms-excel.sheet.macroEnabled.main+xml");
         }

         if (this.a.hasMacro()) {
            this.a("/xl/vbaProject.bin", "application/vnd.ms-office.vbaProject");
         }
      } else if (this.M == 8) {
         this.a("/xl/workbook.xml", "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml");
      } else {
         this.a("/xl/workbook.xml", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml");
      }

      this.a("/docProps/app.xml", "application/vnd.openxmlformats-officedocument.extended-properties+xml");
      boolean var1 = false;

      int var2;
      for(var2 = 0; var2 < this.c.size(); ++var2) {
         zol var3 = (zol)this.c.get(var2);
         String var4;
         if (var3.a.getType() == 1) {
            var4 = "/xl/worksheets/sheet" + zase.y(var3.d) + ".xml";
            this.a(var4, "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml");
         } else if (var3.a.getType() == 2) {
            var4 = "/xl/chartsheets/sheet" + zase.y(var3.d) + ".xml";
            this.a(var4, "application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml");
         }

         if (var3.g != null && var3.g.length() > 0) {
            this.a("/xl/" + var3.g, "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml");
         }

         if (!var1 && (var3.n.a != null || var3.l.a != null)) {
            this.b("vml", "application/vnd.openxmlformats-officedocument.vmlDrawing");
            var1 = true;
         }

         if (var3.m.a != null) {
            var4 = "/xl/drawings/" + var3.m.b;
            this.a(var4, "application/vnd.openxmlformats-officedocument.drawing+xml");
         }
      }

      for(var2 = 1; var2 <= this.k; ++var2) {
         String var5 = "/xl/charts/chart" + zase.y(var2) + ".xml";
         this.a(var5, "application/vnd.openxmlformats-officedocument.drawingml.chart+xml");
      }

      this.a("/xl/sharedStrings.xml", "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml");
      this.a("/docProps/core.xml", "application/vnd.openxmlformats-package.core-properties+xml");
      if (this.h()) {
         this.a("/docProps/custom.xml", "application/vnd.openxmlformats-officedocument.custom-properties+xml");
      }

      if (this.a.h != null && this.a.h.getCount() > 0) {
         this.a("/xl/connections.xml", "application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml");
      }

      this.C();
      this.F();
      this.z();
   }

   znt a(boolean var1, String var2, String var3) {
      znt var4 = new znt();
      if (var1) {
         var4.b = var2;
      } else {
         var4.c = var2;
      }

      var4.d = var3;
      var4.a = var1;
      com.aspose.cells.b.a.a.ze.a(this.o, (Object)var4);
      return var4;
   }

   private void y() {
      zazw var1 = this.a.getWorksheets().k;
      if (var1 != null && var1.getCount() != 0) {
         this.D = new zod(var1);
         if (this.q) {
            this.c("http://schemas.openxmlformats.org/officeDocument/2006/relationships/revisionHeaders", "revisions/revisionHeaders.xml");
            this.c("http://schemas.openxmlformats.org/officeDocument/2006/relationships/usernames", "revisions/userNames.xml");
            this.a("/xl/revisions/revisionHeaders.xml", "application/vnd.openxmlformats-officedocument.spreadsheetml.revisionHeaders+xml");
            this.a("/xl/revisions/userNames.xml", "application/vnd.openxmlformats-officedocument.spreadsheetml.userNames+xml");
         } else {
            this.c("http://schemas.openxmlformats.org/officeDocument/2006/relationships/revisionHeaders", "revisions/revisionHeaders.bin");
            this.c("http://schemas.openxmlformats.org/officeDocument/2006/relationships/usernames", "revisions/userNames.bin");
            this.a("/xl/revisions/revisionHeaders.bin", "application/vnd.ms-excel.revisionHeaders");
            this.a("/xl/revisions/userNames.bin", "application/vnd.ms-excel.userNames");
         }

         for(int var2 = 0; var2 < var1.getCount(); ++var2) {
            zazv var3 = var1.a(var2);
            String var4 = zase.y(var2 + 1);
            this.a("/xl/revisions/revisionLog" + var4 + this.p, this.q ? "application/vnd.openxmlformats-officedocument.spreadsheetml.revisionLog+xml" : "application/vnd.ms-excel.revisionLog");
            String var5 = "rId" + var4;
            var3.b.i = var5;
            zqe var6 = new zqe(var5, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/revisionLog", "revisionLog" + var4 + this.p, (String)null);
            com.aspose.cells.b.a.a.ze.a(this.D.b, (Object)var6);
         }

      }
   }

   private void z() throws Exception {
      int var1 = this.c.size();

      for(int var2 = 0; var2 < var1; ++var2) {
         zol var3 = (zol)this.c.get(var2);
         int var4 = var3.o.size();

         for(int var5 = 0; var5 < var4; ++var5) {
            zob var6 = (zob)var3.o.get(var5);
            String var7 = null;
            String var8 = null;
            if (var6.e != null && !"".equals(var6.e)) {
               var7 = com.aspose.cells.b.a.d.zk.d(var6.e);
               if (var7.length() > 0) {
                  var7 = var7.substring(1);
               }

               switch(O.a(var7)) {
               case 1:
               case 2:
               case 3:
                  var8 = "application/vnd.ms-excel";
                  break;
               case 4:
                  var8 = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
                  break;
               case 5:
                  var8 = "application/vnd.ms-excel.sheet.macroEnabled.12";
                  break;
               case 6:
               case 7:
                  var8 = "application/msword";
                  break;
               case 8:
                  var8 = "application/vnd.ms-word.document.macroEnabled.12";
                  break;
               case 9:
                  var8 = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
                  break;
               case 10:
                  var8 = "application/vnd.ms-word.template.macroEnabled.12";
                  break;
               case 11:
                  var8 = "application/vnd.openxmlformats-officedocument.wordprocessingml.template";
                  break;
               case 12:
                  var8 = "application/vnd.ms-powerpoint";
                  break;
               case 13:
                  var8 = "application/vnd.ms-powerpoint.presentation.macroEnabled.12";
                  break;
               case 14:
                  var8 = "application/vnd.openxmlformats-officedocument.presentationml.presentation";
                  break;
               case 15:
                  var8 = "application/vnd.openxmlformats-officedocument.presentationml.slide";
               }
            }

            if (var8 != null) {
               if (!this.b(var7)) {
                  this.b(var7, var8);
               }
            } else if (!var6.a.isLink()) {
               this.a("/xl/embeddings/" + var6.e, "application/vnd.openxmlformats-officedocument.oleObject");
            }
         }
      }

   }

   private void A() throws Exception {
      if (this.a.g == null && this.a.f == null && this.a.getWorksheets().f() != null && this.a.getWorksheets().f().a().b("MsoDataStore")) {
         ContentTypePropertyCollection var1 = this.a.getContentTypeProperties();
      }

      int var5 = 1;
      zng var2 = this.a.g;
      String var4;
      if (var2 != null && var2.getCount() > 0) {
         for(var5 = 1; var5 <= var2.getCount(); ++var5) {
            znf var3 = var2.a(var5 - 1);
            var4 = zase.y(var5);
            if (var3.a != null) {
               this.c("http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml", "../customXml/item" + var4 + ".xml");
            }

            if (var3.b != null) {
               this.a("/customXml/itemProps" + var4 + ".xml", "application/vnd.openxmlformats-officedocument.customXmlProperties+xml");
            }
         }
      }

      if (this.a.f != null && this.a.f.getCount() > 0) {
         for(int var6 = 0; var6 < 3; ++var6) {
            var4 = zase.y(var5 + var6);
            this.c("http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml", "../customXml/item" + var4 + ".xml");
            this.a("/customXml/itemProps" + var4 + ".xml", "application/vnd.openxmlformats-officedocument.customXmlProperties+xml");
         }
      }

   }

   private void B() {
      Iterator var1;
      String var4;
      if (this.h != null && this.h.size() > 0) {
         for(var1 = this.h.iterator(); var1.hasNext(); this.a(var4, "application/vnd.ms-excel.pivotCacheDefinition")) {
            zqc var2 = (zqc)var1.next();
            zauk var3 = var2.a;
            var4 = "/xl/pivotCache/pivotCacheDefinition" + var2.g + ".bin";
            if (var3.n != null) {
               String var5 = "/xl/pivotCache/pivotCacheRecords" + var2.g + ".bin";
               this.a(var5, "application/vnd.ms-excel.pivotCacheRecords");
            }
         }
      }

      if (this.i != null && this.i.size() > 0) {
         var1 = this.i.values().iterator();

         while(var1.hasNext()) {
            int var6 = (Integer)var1.next();
            String var7 = "/xl/pivotTables/pivotTable" + var6 + ".bin";
            this.a(var7, "application/vnd.ms-excel.pivotTable");
         }
      }

   }

   zqc a(zauk var1) {
      if (this.h != null && this.h.size() > 0) {
         Iterator var2 = this.h.iterator();

         while(var2.hasNext()) {
            zqc var3 = (zqc)var2.next();
            if (var3.a == var1) {
               return var3;
            }
         }
      }

      return null;
   }

   private void C() {
      Iterator var1;
      String var4;
      if (this.h != null && this.h.size() > 0) {
         for(var1 = this.h.iterator(); var1.hasNext(); this.a(var4, "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml")) {
            zqc var2 = (zqc)var1.next();
            zauk var3 = var2.a;
            var4 = "/xl/pivotCache/pivotCacheDefinition" + var2.g + ".xml";
            if (var3.n != null) {
               String var5 = "/xl/pivotCache/pivotCacheRecords" + var2.g + ".xml";
               this.a(var5, "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml");
            }
         }
      }

      if (this.i != null && this.i.size() > 0) {
         var1 = this.i.values().iterator();

         while(var1.hasNext()) {
            int var6 = (Integer)var1.next();
            String var7 = "/xl/pivotTables/pivotTable" + var6 + ".xml";
            this.a(var7, "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml");
         }
      }

   }

   private void D() throws Exception {
      this.w();
      this.a("/xl/theme/theme1.xml", "application/vnd.openxmlformats-officedocument.theme+xml");
      this.a("/xl/styles.bin", "application/vnd.ms-excel.styles");
      if (this.l && this.a.hasMacro()) {
         this.a("/xl/vbaProject.bin", "application/vnd.ms-office.vbaProject");
      } else {
         this.a("/xl/bin", "application/vnd.ms-excel.sheet.binary.macroEnabled.main");
      }

      this.a("/docProps/app.xml", "application/vnd.openxmlformats-officedocument.extended-properties+xml");
      boolean var1 = false;

      int var2;
      for(var2 = 0; var2 < this.c.size(); ++var2) {
         zol var3 = (zol)this.c.get(var2);
         String var4;
         if (var3.a.getType() == 1) {
            var4 = "/xl/worksheets/sheet" + zase.y(var3.d) + ".bin";
            this.a(var4, "application/vnd.ms-excel.worksheet");
         } else if (var3.a.getType() == 2) {
            var4 = "/xl/chartsheets/sheet" + zase.y(var3.d) + ".bin";
            this.a(var4, "application/application/vnd.ms-excel.chartsheet");
         }

         if (var3.g != null && var3.g.length() > 0) {
            this.a("/xl/" + var3.g, "application/vnd.ms-excel.comments");
         }

         if (!var1 && (var3.n.a != null || var3.l.a != null)) {
            this.b("vml", "application/vnd.openxmlformats-officedocument.vmlDrawing");
            var1 = true;
         }

         if (var3.m.a != null) {
            var4 = "/xl/drawings/" + var3.m.b;
            this.a(var4, "application/vnd.openxmlformats-officedocument.drawing+xml");
         }
      }

      for(var2 = 1; var2 <= this.k; ++var2) {
         String var5 = "/xl/charts/chart" + zase.y(var2) + ".xml";
         this.a(var5, "application/vnd.openxmlformats-officedocument.drawingml.chart+xml");
      }

      this.a("/xl/sharedStrings.bin", "application/vnd.ms-excel.sharedStrings");
      this.a("/docProps/core.xml", "application/vnd.openxmlformats-package.core-properties+xml");
      if (this.h()) {
         this.a("/docProps/custom.xml", "application/vnd.openxmlformats-officedocument.custom-properties+xml");
      }

      this.B();
      this.F();
      this.z();
   }

   private String E() {
      if (this.a.b == null) {
         return null;
      } else {
         ArrayList var1 = this.a.b.c;

         for(int var2 = 0; var2 < var1.size(); ++var2) {
            znt var3 = (znt)var1.get(var2);
            if (var3.b != null && "bin".equals(var3.b.toLowerCase())) {
               return var3.d;
            }
         }

         return null;
      }
   }

   private void F() {
      if (this.a.b != null) {
         ArrayList var1 = this.a.b.c;

         for(int var2 = 0; var2 < var1.size(); ++var2) {
            znt var3 = (znt)var1.get(var2);
            if (!var3.a || !this.b(var3.b)) {
               switch(O.a(var3.d)) {
               case 16:
                  if (!this.q) {
                     continue;
                  }
                  break;
               case 17:
               case 18:
               case 19:
                  if (!this.a.getSettings().i()) {
                     continue;
                  }
               }

               com.aspose.cells.b.a.a.ze.a(this.o, (Object)var3);
            }
         }

      }
   }

   private void G() {
      if (this.a.b != null) {
         ArrayList var1 = this.a.b.i.f;

         for(int var2 = 0; var2 < var1.size(); ++var2) {
            zqe var3 = (zqe)var1.get(var2);
            var3.b = var3.c;
            this.e.put(var3.c, var3);
         }

      }
   }

   private void H() throws Exception {
      this.f.clear();
      zaty var1 = new zaty();
      var1.a(this.a.getWorksheets());
      int var2 = var1.size();
      this.f = new HashMap();

      int var3;
      for(var3 = 0; var3 < var2; ++var3) {
         zatx var4 = var1.a(var3);
         if (var4.a() != null) {
            int var5 = this.d();
            String var6 = zase.a("image", var5, var4.b());
            this.f.put(var3 + 1, var6);
         }
      }

      for(var3 = 0; var3 < this.a.getWorksheets().getCount(); ++var3) {
         Worksheet var8 = this.a.getWorksheets().get(var3);
         PictureCollection var9 = var8.getPictures();

         for(int var10 = 0; var10 < var9.getCount(); ++var10) {
            Picture var7 = var9.get(var10);
            if (var7.d() && !this.f.containsKey(var7.getSourceFullName())) {
               this.f.put(var7.getSourceFullName(), var7.getSourceFullName());
            }
         }
      }

   }

   private void I() throws Exception {
      this.g = null;
      zaty var1 = new zaty();
      var1.b(this.a.getWorksheets());
      int var2 = var1.size();
      if (var2 != 0) {
         this.g = new HashMap(var2);

         for(int var3 = 0; var3 < var2; ++var3) {
            zatx var4 = var1.a(var3);
            if (var4.a() != null) {
               int var5 = this.d();
               String var6 = zase.a("image", var5, var4.b());
               this.g.put(var3 + 1, var6);
            }
         }

      }
   }

   boolean h() {
      return this.a.getWorksheets().getCustomDocumentProperties().getCount() > 0;
   }

   private zqe c(String var1, String var2) {
      String var3 = null;

      while(true) {
         var3 = "rId" + this.N;
         if (this.e.get(var3) == null) {
            zqe var4 = new zqe(var3, var1, var2, (String)null);
            this.e.put(var3, var4);
            return var4;
         }

         ++this.N;
      }
   }
}
